package com.by.yz.adapter;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.by.yz.R;
import com.by.yz.activity.CurrentTopicsActivity;
import com.by.yz.entity.TopicInfo;

import java.util.List;

/**
 * Created by mrs yang on 2017/1/12.
 */
public class ImageAdapter extends RecyclerView.Adapter<ImageAdapter.ViewHolder>{
    private Context context;
    private LayoutInflater mLayoutInflater;
    private List<String> result;



    public static class ViewHolder extends RecyclerView.ViewHolder {
        public String tt;
        public final ImageView topicimage;

        public ViewHolder(View view) {
            super(view);
            topicimage= (ImageView) view.findViewById(R.id.hot_topic_image);
        }

    }

    public ImageAdapter(Context context, List<String> result) {
        mLayoutInflater = LayoutInflater.from(context);
        this.context = context;
        this.result = result;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(mLayoutInflater.inflate(R.layout.topic_imageview, null));
    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, final int position) {
        Glide.with(context)
                .load(result.get(position))
                .centerCrop()
                .into(holder.topicimage);
    }

    @Override
    public int getItemCount() {
        return result.size();
    }
}
